const express=require('express');
const static=require('express-static');
const mysql=require('mysql');

let server=express();

server.listen(666);

let db=mysql.createConnection({
    host:'localhost',
    user:'root',
    password:'',
    database:'nodedb'
})

server.get('/dong',(request,respones)=>{

    db.query('select * from dong',(err,data)=>{
        console.log(data);
        if(err){
            respones.send({err:1,desc:'数据库错误'});
            respones.end();
        }else{
            respones.send({err:0,data});
            respones.end();
    }
})
})

server.use(static('xindongfang'));
